package org.dey.controller;


import org.dey.entity.Result;
import org.dey.pojo.InterventionTemplate;
import org.dey.pojo.PageVo;
import org.dey.pojo.Setmeal;
import org.dey.service.InterventionTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author hg
 * @date 2022/4/5
 * @classname
 */
@RestController
public class InterventionTemplateController {

    @Autowired
    InterventionTemplateService interventionTemplateService;

    //检查组信息查询
    @PostMapping("templateXx.action/{pageNum}/{pagesize}")
    public PageVo<InterventionTemplate> templateXx(@RequestBody InterventionTemplate interventionTemplate ,
                                                  @PathVariable int pageNum,
                                                  @PathVariable int pagesize) {
        PageVo<InterventionTemplate> list = interventionTemplateService.setmealXx(interventionTemplate, pageNum, pagesize);

        return list;
    }

    //逻辑删除
    @DeleteMapping("templateXx.action/{id}")
    public Result templateXxsc(@PathVariable int id){
       Result result = interventionTemplateService.templateXxsc(id);
       return result;
    }

    //添加模版
    @PostMapping("addtemplateXx.action")
    public Result addtemplateXx(@RequestBody InterventionTemplate interventionTemplate) {
       Result list = interventionTemplateService.addtemplateXx(interventionTemplate);

        return list;
    }

    //查找该模块已有的干预项目id
    @GetMapping("/templateXx.do/{id}")
    public InterventionTemplate querytemplateXxbyid(@PathVariable int id) {
        InterventionTemplate interventionTemplate = interventionTemplateService.querytemplateXxbyid(id);

        return interventionTemplate;
    }


    //修改模版数据
    @PostMapping("updatetemplateXx.do")
    public Result updatetemplateXx(@RequestBody InterventionTemplate interventionTemplate) {
        Result list = interventionTemplateService.updatetemplateXx(interventionTemplate);

        return list;
    }

    //制定干预时加载模版信息
    @GetMapping("/moban.do")
    public List<InterventionTemplate> mobanXx() {
        List<InterventionTemplate> interventionTemplate = interventionTemplateService.mobanXx();

        return interventionTemplate;
    }
}
